CREATE TABLE [dbo].[DrugDispo]
(
[DrugId] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DrugName] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[GenericName] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Specification] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Unit] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MarkUpType] [int] NULL,
[CostPrice] [decimal] (12, 0) NOT NULL,
[SellPrice] [decimal] (12, 0) NOT NULL,
[ValidPeriod] [datetime] NULL,
[MinStock] [int] NULL CONSTRAINT [DF_DrugDispo_MinStock] DEFAULT ((0)),
[MaxStock] [int] NULL CONSTRAINT [DF_DrugDispo_MaxStock] DEFAULT ((0)),
[Shelf] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GroupId] [int] NULL,
[ClassificationId] [int] NULL,
[UseGuide] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Precaution] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Package] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IsControlDrug] [bit] NOT NULL CONSTRAINT [DF_DrugDispo_IsControlDrug] DEFAULT ((0)),
[Remark] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [PK_DrugDispo] PRIMARY KEY CLUSTERED  ([DrugId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [FK_DrugDispo_Classification] FOREIGN KEY ([ClassificationId]) REFERENCES [dbo].[Classification] ([ClassificationId])
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [FK_DrugDispo_Group] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[Group] ([GroupId])
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [FK_DrugDispo_MarkUpType] FOREIGN KEY ([MarkUpType]) REFERENCES [dbo].[MarkUpType] ([MarkUpType])
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [FK_DrugDispo_Shelf] FOREIGN KEY ([Shelf]) REFERENCES [dbo].[Shelf] ([Shelf])
GO
ALTER TABLE [dbo].[DrugDispo] ADD CONSTRAINT [FK_DrugDispo_UnitTable] FOREIGN KEY ([Unit]) REFERENCES [dbo].[UnitTable] ([Unit])
GO
